#include "shopinf.h"
#include "ui_shopinf.h"
#include<QPixmap>
#include"shopinffroom.h"
shopinf::shopinf(QWidget *parent) : QWidget(parent),
    ui(new Ui::shopinf)
{

    ui->setupUi(this);

    islog = false;
}


shopinf::~shopinf()
{
    delete ui;
}
void shopinf::init (Getinftonet *ginfs){
    ginf = ginfs;
}

void shopinf::getshopinfo(structshopinf* a){
    emit sigchangeislog(a->IsLogin);
    ui->label_ShopName->setText("店铺名："+QString(a->ShopName));
    islog = a->IsLogin;
    ui->label_shoper->setText("店 长："+QString(a->shoper));
    ui->label_PhoneNumber->setText("联系方式："+QString(a->PhoneNumber));
    QString hoptyp = "营业时间";
    if (a->shoptyp[0]=="1")
        hoptyp.append(" 早餐&");
    if (a->shoptyp[1]=="1")
        hoptyp.append(" 午餐&");
    if (a->shoptyp[2]=="1")
        hoptyp.append(" 晚餐");
    ui->label_shoptyp->setText(hoptyp);
    ui->label_fdstype->setText(QString(a->fdstype));
    ui->label_text->setText(QString(a->text));
    ui->label_addr->setText(QString(a->addr));

}

void shopinf::drowshopinfimg(QByteArray* img){
    QPixmap * P = new QPixmap;
    P->loadFromData(*img);
    ui->labe_shopinfimg->setPixmap(*P);
    ui->labe_shopinfimg->setScaledContents(true);
    ui->labe_shopinfimg->show();
    delete P;
}

//void shopinf::on_pushButton_clicked()
//{
//    emit siggetinftochick();
//}

void shopinf::on_frech_clicked()
{
    emit siggetinftochick();
}

/* 设置按钮 */
void shopinf::on_pushButton_2_clicked()
{
    shopinffroom *sp = new shopinffroom(0);
    sp->init(islog,ginf);
    sp->show();

}
